<template>
    <div>
        <!-- 轮播图区域 -->
        <!-- <mt-swipe :auto="2000">
            <mt-swipe-item v-for="(item,i) in lunbotu" :key="i">
                <img :src="item.img" alt="" srcset="">
            </mt-swipe-item>
        </mt-swipe> -->
        <!-- 把轮播图抽离到公共组件 -->
        <swiper :lunbotu="lunbotu" :imgname="'img'" :isfull="true"></swiper>

        <!-- 9宫格区域 -->
        <ul class="mui-table-view mui-grid-view mui-grid-9">
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="/home/newslist">
                    <img src="/images/menu1.png" alt="" srcset="">
                    <div class="mui-media-body">新闻资讯</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="/home/photolist">
                    <img src="/images/menu2.png" alt="" srcset="">
                    <div class="mui-media-body">图片分享</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="/home/goodslist">
                    <img src="/images/menu3.png" alt="" srcset="">
                    <div class="mui-media-body">商品购买</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="#">
                    <img src="/images/menu4.png" alt="" srcset="">
                    <div class="mui-media-body">留言反馈</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="#">
                    <img src="/images/menu5.png" alt="" srcset="">
                    <div class="mui-media-body">视频专区</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="#">
                    <img src="/images/menu6.png" alt="" srcset="">
                    <div class="mui-media-body">联系我们</div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
// 导入轮播图组件
import swiper from '.././sub-components/Swiper.vue'

export default {
    data:function(){
        return {
            lunbotu:[]
        }
    },
    created:function(){
        this.getLunbo();
    },
    methods:{
        // 获取轮播图的方法
        getLunbo:async function(){
            const {data}=await this.$http.get("/api/getlunbo");
            console.log(data);
            if(data.status===0) this.lunbotu=data.message;
            // this.$http.get("/api/getlunbo").then((res)=>{
            //     console.log(res.data);
            //     if(res.data.status===0) this.lunbotu=res.data.message;
        },
    },
    components:{
        // 注册轮播图组件
        swiper,
    }
}
</script>

<style lang="scss" scoped>

// 轮播图的样式
// .mint-swipe{
//     height: 180px;
// }
// .mint-swipe-item{
//     &:nth-child(1){
//         background-color:darkgray
//     }
//     &:nth-child(2){
//         background-color:blanchedalmond
//     }
//     &:nth-child(3){
//         background-color:chocolate
//     }
//     img{
//         width: 100%;
//         height:100%;
//     }
// }

// 九宫格的样式
.mui-col-sm-3{
    width:33.33%;
}
.mui-grid-view.mui-grid-9{
    background-color: #fff;
    border: none;
}
.mui-grid-view.mui-grid-9 .mui-table-view-cell{
    border: none;
}
.mui-grid-view{
    li{
        img{
            width: 60px;
            height: 60px;
        }
    }
}
.mui-table-view.mui-grid-view .mui-table-view-cell .mui-media-body{
    font-size: 13px;
}
</style>